package org.zwd.computePrice.action;

import org.zwd.computePrice.domain.User;
import org.zwd.computePrice.service.UserService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class UserAction extends ActionSupport{

	private static final long serialVersionUID = 1L;
	
	private int userid; 
	private User user;
	
	private UserService userService = new UserService();
	
	public String updateUI() throws Exception{
		User user = userService.findUserByid(userid);
		System.out.println(user);
		ActionContext.getContext().put("user", user);
		return "updateUI";
	}

	public String update() throws Exception{
		userService.updateUserByid(user);
		return "update";
	}

	public int getUserid() {
		return userid;
	}

	public void setUserid(int userid) {
		this.userid = userid;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
}
